package dcutils.rpg.currency;

/**
 * A Unit represents a single monetary type and its base value.<br/>
 * I.e.: A Copper can only represent a single copper piece.<br/>
 * If you need to represent multiple Copper pieces, use the Quantity class.
 * @see Quantity
 * @author dca
 */
public enum Unit {
   COPPER("Copper", 1),
   SILVER("Silver", COPPER.getBaseValue() * 100),
   GOLD("Gold", SILVER.getBaseValue() * 100);

   private String baseName;
   private int baseValue;

   private Unit(String name, int value) {
      baseName = name;
      baseValue = value;
   } // END constructor

   public String getBaseName() {
      return baseName;
   } // END getBaseName

   public int getBaseValue() {
      return baseValue;
   } // END getBaseValue

   @Override
   public String toString() {
      return String.format("%s (%d)", baseName, baseValue);
   } // END toString
} // END enum Unit
